<?php require_once('../src/session_start.inc.php'); ?>
<?php
if (isset($_SESSION['authentificated']) && $_SESSION['authentificated']) {
	header('Location: home.php');
} ?>
<?php
require_once('../src/functions.php');
$message = "Veuillez vous identifier";
if (isset($_POST['login']) && $_POST['login'])
{
	if ($_POST['user']=='administrator' &&
		md5($_POST['password'])=='0fe60af2ab6b6924ed53421918b9652b')
	{
	    $_SESSION['authentificated'] = true;
		log_error("IDENTIFICATION de administrator", true);
		header('Location: home.php');
	}
	else
	{
		$message = '<span class="error">Veuillez vérifier votre identifiant et mot de passe.</span>';
	}
}
?>
<?php $noredirect=true; require_once('admin_header.php'); ?>

<form action="login.php" method="post">
	<fieldset>
	<legend><?php echo $message; ?></legend>
		<p>
			<label for="user">Identifiant:&nbsp;</label>
			<input type="text" id="user" name="user" value=""/>
		</p>
		<p>
			<label for="password">Mot de passe:&nbsp;</label>
			<input type="password" id="password" name="password" value=""/>
		</p>
		<p>
			<input type="hidden" id="login" name="login" value="1"/>
			<input type="submit" class="submit" id="submit" name="submit" value="S'identifier"/>
			<input type="reset" class="reset" id="reset" name="reset" value="Effacer"/>
		</p>
	</fieldset>
</form>

<p>Aller sur le <a href="<?php echo URL ?>accueil">site public</a>.</p>

<?php require_once('admin_footer.php'); ?>